package com.equis.estacionamientos.components.map {
	import com.equis.estacionamientos.bean.estacionamiento.FullEstacionamiento;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	import mx.events.CloseEvent;
	
	public class InfoWindowSprite extends Sprite {
		[Embed(source="assets/images/eiffel_tower.png")]
		private var EiffelTowerImage:Class;
		
		private var _fullEstacionamiento:FullEstacionamiento;
		
		public function InfoWindowSprite(fullEstacionamiento:FullEstacionamiento) {
			this._fullEstacionamiento = fullEstacionamiento
			graphics.lineStyle(1, 0x406080);
			graphics.beginFill(0x80c0ff);
			graphics.drawEllipse(-6, 0, 12, 8);
			graphics.drawEllipse(-3, -14, 18, 12);
			graphics.drawEllipse(4, -34, 24, 18);
			graphics.drawEllipse(18, -60, 36, 24);
			graphics.drawEllipse(44, -120, 108, 72);
			graphics.endFill();
			
			var image:Bitmap = new EiffelTowerImage();
			image.x = 76;
			image.y = -116;
			addChild(image);
			
			var closeButton:Sprite = new Sprite();
			closeButton.buttonMode = true;
			closeButton.graphics.beginFill(0x000000);
			closeButton.graphics.drawCircle(0, 0, 10);
			closeButton.graphics.endFill();
			closeButton.graphics.beginFill(0xff0000);
			closeButton.graphics.drawCircle(0, 0, 3);
			closeButton.graphics.endFill();
			closeButton.x = 98;
			closeButton.y = -60;
			addChild(closeButton);
			
			var me:Sprite = this;
			closeButton.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
				me.dispatchEvent(new CloseEvent(CloseEvent.CLOSE)); 
			});
			
			cacheAsBitmap = true;
		}
	}
}